package com.example.makerspace.controller.bulletin;


import com.example.makerspace.domain.CustomizeBulletinDO;
import com.example.makerspace.domain.ImsingleDO;
import com.example.makerspace.dto.CustomizeBulletinDTO;
import com.example.makerspace.dto.PageRequest;
import com.example.makerspace.dto.Result;
import com.example.makerspace.service.BulletinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping(value = "/api/expert")
@Api(tags = "自定义-公告模块")
public class BulletinController {

    @Resource
    private BulletinService bulletinService;

    @ApiOperation(value="获取公告列表接口",notes ="获取公告列表接口说明")
    @GetMapping("/getBulletin")
    public Result getBulletin(HttpServletRequest request) {
         return  bulletinService.getBulletin(request);
    }

    @ApiOperation(value="获取公告列表-左边数据接口",notes ="获取公告列表-左边数据接口")
    @PostMapping("/getLeftBulletin")
    public Result getLeftBulletin(@RequestBody PageRequest pageRequest,HttpServletRequest request) {
        return  bulletinService.getLeftBulletin(pageRequest,request);
    }



    @ApiOperation(value="添加公告模块-后台",notes ="加公告模块-后台说明")
    @GetMapping("/addBulletin")
    public Result addBulletin(@ModelAttribute CustomizeBulletinDTO customizeBulletinDTO) {
        return     bulletinService.addBulletin(customizeBulletinDTO);
    }
    @ApiOperation(value="修改公告模块-后台",notes ="修改公告模块-后台说明")
    @GetMapping("/updateBulletin")
    public Result updateBulletin(@ModelAttribute CustomizeBulletinDTO customizeBulletinDTO) {
        return     bulletinService.updateBulletin(customizeBulletinDTO);
    }
    @ApiOperation(value="删除公告模块-后台",notes ="删除公告模块-后台说明")
    @GetMapping("/deleteBulletin")
    public Result deleteBulletin(@RequestParam("id")Integer id) {
        return     bulletinService.deleteBulletin(id);
    }
    @ApiOperation(value="展示公告列表模块-后台",notes ="展示公告列表模块-后台说明")
    @GetMapping("/listBulletin")
    public Result listBulletin(@RequestBody PageRequest pageRequest) {
        return     bulletinService.listBulletin(pageRequest);
    }


}
